﻿<%@ Control Language="VB" AutoEventWireup="true" CodeFile="List.ascx.vb" Inherits="Control_Contents_List" %>
<%@ Register TagPrefix="aspNewControls" Namespace="NewControls" %>
<script type='text/javascript'>

    function confirmMultiDelete(strID) {
        var grdShow = document.getElementById("<%=grdShow.ClientID %>");
        var count = 0;
        for (i = 1; i < grdShow.children.item(0).children.length; i++) {
            if (grdShow.children.item(0).children.item(i).children.item(0).children.item(0).checked) {
                count += 1;
            }
        }
        if (count > 0) {
            return ComfirmDialog('<%=drpMessage.Items(1).Text%>', 0, strID, 0, 0);
        } else {
            Alertbox('<%=drpMessage.Items(2).Text%>');
            return false;
        }
    }
    function ComfirmDialog(strText, value, ObjectIdClick, ID, Type) {
        if (value == 0) {
            Confirmbox(strText, value, ObjectIdClick, ID, Type);
            return false;
        } else {
            if (Type == 1) {
                document.getElementById('<%=hidID.ClientID %>').value = ID;
                eval($("#" + ObjectIdClick + "").attr("href"));
            }
            else {

                $("#" + ObjectIdClick + "").click();
            }
        }
    }

    function confirmMultiChange(strID) {
        var grdShow = document.getElementById("<%=grdShow.ClientID %>");
        var count = 0;
        for (i = 1; i < grdShow.children.item(0).children.length; i++) {
            if (grdShow.children.item(0).children.item(i).children.item(0).children.item(0).checked) {
                count += 1;
            }
        }

        if (count > 0) {
            self.parent.tb_remove();
            $("#btnShowChangeMenu").click();
            return false;
        } else {
            Alertbox('<%=drpMessage.Items(2).Text%>');
            return false;
        }
    }

    //set Value hiddenfield


    function setChooseBranchNewsParentValue() {


        var id = $("#<% =ddlMenuChange.ClientID %>").val();
        $("#<% =BranchNewsId.ClientID %>").val(id);

        self.parent.tb_remove();

        $("#<%=btnChange.ClientId %>").click();

    }

    function ajaxJquery() {


        $(function () {

            $(".ItemDisabled").attr("disabled", "true");
            $("#<%=txtStartCreated.ClientID %>").datepicker({ dateFormat: 'dd/mm/yy' });
            $("#<%=txtEndCreated.ClientID %>").datepicker({ dateFormat: 'dd/mm/yy' });

            //for enter search
            $(".SubjectTitle input, .SubjectTitle select").keypress(function (e) {
                if (e.keyCode == 13) {
                    $("#<%=btnFilter.ClientID()%>").click();
                    return false;
                }
            });


            //check cookie to show or hide search pannel
            if ($.cookie('CookieSSMSearch') == 1) {
                $('#pnlSearch').show();
            }
            else {
                $('#pnlSearch').hide();
            }


            $('#B1').click(function (event) {

                //set cookie
                if ($.cookie('CookieSSMSearch') == 1) {
                    $.cookie('CookieSSMSearch', 0)
                }
                else {
                    $.cookie('CookieSSMSearch', 1)
                }
                $('#pnlSearch').slideToggle(500);
                if ($('#imgShowHide').attr("src") == "../../images/arrow_popup.gif") {

                    $('#imgShowHide').attr("src", "../../images/arrow_showless.gif");
                }
                else {
                    $('#imgShowHide').attr("src", "../../images/arrow_popup.gif");
                }
            });

        });

    }
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3>
                    QUẢN LÝ NỘI DUNG</h3>
            </div>
            <div class="box_contentform">
                <div class="box_scroll_grid">
                    <div class="BoxField">
                        Tạo mới nội dung:<asp:DropDownList ID="cboAction" CssClass="TextBox" Width="100px"
                            runat="server" AutoPostBack="True">
                            <asp:ListItem Value="0">--- Chọn ---</asp:ListItem>
                            <asp:ListItem Value="1">Tin tức</asp:ListItem>
                            <asp:ListItem Value="2">Video</asp:ListItem>
                            <asp:ListItem Value="3" Enabled="False">Bình chọn</asp:ListItem>
                            <asp:ListItem Value="4">Album ảnh</asp:ListItem>
                            <asp:ListItem Value="5" Enabled="False">Tip</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div >
                        <div class="Error">
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtStartCreated"
                                Display="None" ErrorMessage="Ngày tạo đầu không đúng định dạng" ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$"></asp:RegularExpressionValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtEndCreated"
                                Display="None" ErrorMessage="Ngày tạo cuối không đúng định dạng" ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$"></asp:RegularExpressionValidator>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="#FF3300" />
                        </div>
                    </div>
                    <div class="SubjectTitle" id="SInfor" runat="server">
                        <legend class="SubjectTitle">
                            <img alt="" src="../../images/arrow_showless.gif" id="imgShowHide" />
                            <a id="B1" href="#">Tìm kiếm </a>
                            &nbsp;&nbsp;</legend>
                    </div>
                    <div id="pnlSearch" class="SubjectTitle">
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Nhánh tin:
                        </div>
                        <div style="width: 700px; height: 20px;">
                            <aspNewControls:NewDropDownList ID="drlParent" runat="server" CssClass="TextBox"
                                Width="203px">
                            </aspNewControls:NewDropDownList>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Tiêu đề:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:TextBox ID="txtTitleFilter" runat="server" CssClass="TextBox" Width="200px">
                            </asp:TextBox>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right; display: none"
                            class="SubjectTitle">
                            Loại:</div>
                        <div style="width: 700px; height: 20px; display: none">
                            <asp:DropDownList ID="drlType" runat="server" Width="203px" CssClass="TextBox">
                                <asp:ListItem Value="0">---Tất cả---</asp:ListItem>
                                <asp:ListItem Value="1">Tin tức</asp:ListItem>
                                <asp:ListItem Value="2">Video</asp:ListItem>
                                <asp:ListItem Value="3">Bình chọn</asp:ListItem>
                                <asp:ListItem Value="4">Album ảnh</asp:ListItem>
                                <asp:ListItem Value="5">Tip</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right; display: none"
                            class="SubjectTitle">
                            Tin mới:</div>
                        <div style="width: 700px; height: 20px; display: none">
                            <asp:DropDownList ID="ddlSSMOriginal" runat="server" CssClass="TextBox" Width="203px">
                                <asp:ListItem Value="-1" Selected="True">---Tất cả---</asp:ListItem>
                                <asp:ListItem Value="1">Yes</asp:ListItem>
                                <asp:ListItem Value="0">No</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Ngày tạo:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:TextBox ID="txtStartCreated" runat="server" Width="90px" CssClass="TextBox"></asp:TextBox>
                            tới:
                            <asp:TextBox ID="txtEndCreated" runat="server" Width="90px" CssClass="TextBox"></asp:TextBox>(dd/mm/yyyyy)
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Tuần:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:DropDownList ID="ddlWeek" runat="server" Width="80px" CssClass="TextBox">
                            </asp:DropDownList>
                            năm:
                            <asp:DropDownList ID="ddlYear" runat="server" Width="80px" CssClass="TextBox">
                            </asp:DropDownList>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Người tạo:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:TextBox ID="txtNguoitao" runat="server" Width="200px" CssClass="TextBox"></asp:TextBox>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Trạng thái:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:DropDownList ID="drlStatus" runat="server" Width="203px" CssClass="TextBox">
                            </asp:DropDownList>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                            Sắp xếp:</div>
                        <div style="width: 700px; height: 20px;">
                            <asp:DropDownList ID="ddlSort" runat="server" Width="203px" CssClass="TextBox">
                                <asp:ListItem Value="1" Selected="True">Ngày tạo</asp:ListItem>
                                <asp:ListItem Value="2">Lượt xem</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div style="clear: both; height: 5px;">
                        </div>
                        <div style="float: left; width: 200px; height: 20px; text-align: right;" class="SubjectTitle">
                        </div>
                        <div style="width: 700px; height: 20px;">
                            <asp:Button ID="btnFilter" runat="server" Text='Tìm kiếm' CssClass='btn' />
                            &nbsp;<asp:Button ID="btnClear" runat="server" CausesValidation="false" CssClass="btn"
                                Text="Hủy" />
                        </div>
                        <div style="clear: both; height: 10px;">
                        </div>
                    </div>
                    <div style="clear: both; height: 10px;">
                    </div>
                    <asp:GridView ID="grdShow" runat="server" AutoGenerateColumns="False" EmptyDataText="{Không có dữ liệu}"
                        Width='100%' BorderWidth="1px" CssClass="GridBorder">
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:CheckBox ID="CheckAll" runat="server" AutoPostBack="False" onclick="CheckAll(this)"
                                        Width="30px" />
                                </HeaderTemplate>
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkItem" runat="server" />
                                </ItemTemplate>
                                <ItemStyle Width="5%" HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:HyperLink ID="hplEdit" runat="server" Text="Sửa"></asp:HyperLink>&nbsp;|&nbsp;
                                    <asp:LinkButton ID="lnkbtnDelete" Text="Xóa" runat="server" OnClick="lnkbtnDelete_Click"
                                        CausesValidation='False'></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridTextLink" HorizontalAlign="Center" Width="10%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="STT">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblSTT" Text=''></asp:Label>
                                </ItemTemplate>
                                <ItemStyle Width="5%" HorizontalAlign="Left" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText='Tiêu đề'>
                                <ItemTemplate>
                                    <asp:HyperLink ID="hplTitle" runat="server"></asp:HyperLink>
                                </ItemTemplate>
                                <ItemStyle Width='15%' CssClass='text_list_links' HorizontalAlign='Left' />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText='Nhánh tin'>
                                <ItemTemplate>
                                    <asp:HyperLink ID="lblMenuTile" runat="server"></asp:HyperLink>
                                </ItemTemplate>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width='9%' HorizontalAlign='Left' />
                            </asp:TemplateField>
                            <asp:BoundField HeaderText='Ngày tạo' DataFormatString="{0:dd/MM/yyyy HH:mm}" DataField='Created'>
                                <ItemStyle Width='12%' />
                            </asp:BoundField>
                            <asp:BoundField HeaderText='Người tạo' DataField='Creator'>
                                <ItemStyle Width='8%' />
                            </asp:BoundField>
                            <asp:BoundField HeaderText='Ngày cập nhật cuối' DataFormatString="{0:dd/MM/yyyy HH:mm}"
                                DataField='Modified'>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width='10%' />
                            </asp:BoundField>
                            <asp:BoundField HeaderText='Người cập nhật cuối' DataField='Modifier'>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width='10%' />
                            </asp:BoundField>
                            <asp:BoundField HeaderText='Trạng thái' DataField='Status'>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width='8%' />
                            </asp:BoundField>
                            <asp:BoundField HeaderText='Lượt xem' DataField='Viewed'>
                                <ItemStyle Width='13%' />
                            </asp:BoundField>
                        </Columns>
                        <HeaderStyle Height="26px" HorizontalAlign="Left" CssClass="GridHeader" />
                        <RowStyle CssClass="GridRow" Height="23px" />
                        <AlternatingRowStyle CssClass="GridAlterRow" />
                        <PagerStyle CssClass="GridPaged" HorizontalAlign="Right" Height="23px" />
                        <PagerSettings Mode="Numeric" PageButtonCount="2" />
                        <EmptyDataRowStyle CssClass="GridTextEmpty" HorizontalAlign="Center" />
                    </asp:GridView>
                    <div id="shownhanhtin">
                        <asp:Button ID="btnChange" CssClass="btn" runat="server" Text=" Chuyển" />
                        <asp:Button ID="btnDelete" CssClass="btn" runat="server" Text="Xóa" />
                        <asp:Button ID="btnPublish" CssClass="btn" runat="server" Text="Trạng Thái"   Visible="false"/>
                        <asp:Button ID="btnExportToExcel" runat="server" CssClass="btn" PostBackUrl="~/Page/Contents/List.aspx"
                            Text="Xuất Excel" CausesValidation="false" Visible="false"></asp:Button>
                        <asp:Button ID="btnExportToHtml" CssClass="btn" runat="server" Text="Xuất HTML" Visible="false" />
                        <asp:Label ID="lblPage_Size" runat="server" Text="Số bản ghi trên trang:"></asp:Label>
                        <asp:DropDownList ID="drpPage_Size" runat="server" AutoPostBack="True" Width="70px"
                            CssClass="input_form">
                            <asp:ListItem Text="10" Value="10"></asp:ListItem>
                            <asp:ListItem Text="20" Value="20"></asp:ListItem>
                            <asp:ListItem Text="50" Value="50" Selected></asp:ListItem>
                            <asp:ListItem Text="100" Value="100"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="lblTotal" runat="server"></asp:Label></div>
                    <div style="width: 100%">
                        <!--phan trang-->
                        <div id="results_resultsNavigationDiv" class="paginationEMP">
                            <ul>
                                <asp:LinkButton ID="lnkFirst" runat="server"></asp:LinkButton>
                                <asp:Repeater ID="rptPage" runat="server">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkTitle" CssClass="page_num" runat="server" OnClick="lnkTitle_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <asp:LinkButton ID="lnkLast" runat="server"></asp:LinkButton>
                            </ul>
                        </div>
                        <asp:HiddenField ID="hidCount" Value="0" runat="server" />
                        <asp:HiddenField ID="hidIndex_page" Value="0" runat="server" />
                        <asp:HiddenField ID="hidCur_Page" Value="1" runat="server" />
                    </div>
                    <%-- </fieldset>--%>
                    <div style="display: none">
                        <asp:DropDownList ID="drpMessage" runat="server">
                            <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản ghi này không?' Value='0'></asp:ListItem>
                            <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản đã chọn?' Value='1'></asp:ListItem>
                            <asp:ListItem Text='Bạn phải chọn ít nhất một bản ghi.' Value='2'></asp:ListItem>
                        </asp:DropDownList>
                        <asp:HiddenField ID="hidID" Value="0" runat="server" />
                        <asp:HiddenField ID="BranchNewsId" Value="0" runat="server" />
                        <asp:HiddenField ID="hidSearch" Value="0" runat="server" />
                        <asp:HyperLink ID="lnkBrankNewsModal" runat="server" CssClass="thickbox" Text=""
                            NavigateUrl="~/Page/ChooseBranchNews/ChooseBranchNews.aspx?keepThis=true&TB_iframe=true&height=140&width=265&modal=true"></asp:HyperLink>
                    </div>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
<%-- Phan danh cho ChangeMenu--%>
<div id="ChangeMenuBox" style="display: none" class="box_popup_login">
    <div class="title_popup_login">
        <div class="icon_title_popup">
            <asp:ImageButton ID="image" CausesValidation="false" OnClientClick="self.parent.tb_remove();"
                ToolTip="Đóng cửa sổ" ImageUrl="~/Control/Messagebox/msbox_image/close_popup.png"
                align="middle" border="0" Width="19" Height="19" runat="server" />
        </div>
    </div>
    <div class="clearboth">
    </div>
    <div class="mid_popup_login">
        <div class="BoxField" style="background-color: #ffffff;">
            <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="lblGroupname" CssClass="TextLabel" runat="server" Text="Chọn nhánh tin: " />
                </div>
                <div class="DivTextBox">
                    <aspNewControls:NewDropDownList ID="ddlMenuChange" runat="server" CssClass="TextBox">
                    </aspNewControls:NewDropDownList>
                </div>
                <div class="DivLabel" style="padding-top: 10px">
                    <asp:Button ID="btnSelectMenu" CssClass="btn" runat="server" CausesValidation="False"
                        Text="Chọn" />
                    <input name="btnAcept" type="submit" onclick="self.parent.tb_remove();" value="Hủy"
                        class="btn" />
                </div>
            </div>
        </div>
    </div>
</div>
<div style="display: none">
    <input id="btnShowChangeMenu" alt="#TB_inline?height=120&width=305&modal=true&inlineId=ChangeMenuBox"
        title="add a caption to title attribute / or leave blank" class="thickbox" type="button"
        value="Show" />
</div>
